7.3 数据分析结果的提取和注入 EMP_result
模块EMP_result可以提取EasyMultiProfiler
分析流程中对象中存储的数据分析结果,并可以将符合格式要求的外部数据分析结果导入对象,联合在一起进行数据分析。
7.3.1 数据分析结果的提取
当对一个组学进行多次数据分析时,已经完成的数据分析结果会被存储在对象中。模块EMP_result
可以根据需求快速提取所需数据分析的原始结果。
result <- MAE |>
EMP_assay_extract('geno_ec') |>
EMP_alpha_analysis() |>
EMP_diff_analysis(method = 'DESeq2',.formula = ~Group) |>
EMP_enrich_analysis(pvalue<0.05,keyType='ec',pvalueCutoff=0.05)
diff_re <- result |> EMP_result(info = 'EMP_diff_analysis')
alpha_re <- result |> EMP_result(info = 'EMP_alpha_analysis')
enrich_re <- result |> EMP_result(info = 'EMP_enrich_analysis')
7.3.2 数据分析结果的注入
任何分析工具包都难以囊括全部的数据分析处理方式,EMP_result
模块可以将外部其他软件分析的结果导入数据对象中,协同EasyMultiProfiler
内的分析结果进行联合分析。
🏷️示例:可以将外部vegan包计算多样性结果导入EMPT
对象内。
Step1:提取微生物的物种注释数据。
tax_se <- MAE |>
EMP_assay_extract('taxonomy')
assay_data <- tax_se |>
EMP_assay_extract(action = 'get')
Step2:使用vegan包计算shannon多样性指数,并命名为new_shannon
。
assay_data <- assay_data |> tibble::column_to_rownames('primary')
shannon_index <- vegan::diversity(assay_data,index = 'shannon')
new_result <- tibble::tibble(primary=names(shannon_index),new_shannon=shannon_index)
new_result
注意:
新增结果中的名称不允许与已经在数据结果内存在的名称重复,否则会导致模块
新增结果中的名称不允许与已经在数据结果内存在的名称重复,否则会导致模块
EMP_filter
无法正常使用。例如,在本示例中需要将外部结果的shanon
指数更名为new_shannon
, 从而避免与EMP_alpha_analysis
的结果名称重复。
### inject the new result into EMPT object
EMP_result(tax_se,
value_name = 'new_alpha',
affect_when_sample_changed=0,
affect_when_feature_changed=1,
attribute='primary',
attribute2='normal',source='user_import') <- new_result
tax_se |>
EMP_filter(sample_condition = new_shannon >4)